import { createApp } from 'vue'
import App from './App.vue'
import plugin from '@/plugins'
import router, { setupRouter } from '@/router/index'
import { useStore } from './store'

import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import '@/styles/index.scss'

import flux from '@/core/index'
import util from '@/utils/index'
import api from '@/apis/index'
flux.prop('util', util)
flux.prop('api', api)


async function bootstrap() {
    const app = createApp(App)
    plugin(app)

    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
        app.component(key, component)
    }

    flux.prop('store', useStore())
    
    setupRouter(app)
    await router.isReady()

    app.mount('#app')
}

void bootstrap()
